﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register src="mycontrol.ascx" tagname="mycontrol" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Login Page</title>
</head>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<body>
    <div class="container">
	<form id="Form1" class="well span11 text-center" runat="server">	

	<uc1:mycontrol ID="mycontrol1" runat="server" />
    <br />

	<table class="table container text-left">
	
	<tr>
	
	<td><br/>
	<asp:Label ID="Label1" runat="server" Text="Label">User Name:</asp:Label>
	</td>
	
    <td><br/>
        <asp:TextBox ID="TextBox2" runat="server" class="span4" type="username" 
            placeholder="Type your Username..." MaxLength="20"/>
    </td>
    
    <td><br/>
           <asp:RequiredFieldValidator ID="RequiredFieldValidator1" 
           runat="server" 
           ErrorMessage="RequiredFieldValidator" 
           ControlToValidate="TextBox2">
                You need to type your Username
           </asp:RequiredFieldValidator>
           
           <br />
           
            <asp:CustomValidator runat="server" 
            ID="CustomValidator2" 
            ControlToValidate="TextBox2"
            Text="Username length should be more than 6 digits" 
            ClientValidationFunction="clientValidate" 
            Display="Dynamic">
            </asp:CustomValidator>
            
            <br />
            
             <asp:RegularExpressionValidator id="RegularExpressionValidator2" 
             ControlToValidate="TextBox1"
             ValidationExpression="[a-zA-Zs0-9]{6,20}$"
             AutoPostBack="true"
             Display="Static"
             ErrorMessage="Username must contain only Alpha-Numeric Characters"
             EnableClientScript="False" 
             runat="server"/>
    </td>
    
    </tr>
	
	<tr>
	
	<td><br/>
	        <asp:Label ID="Label2" runat="server" Text="Label">Password:</asp:Label>
	</td>
	
    <td><br/>
            <asp:TextBox ID="TextBox1" 
            runat="server" 
            class="span4" 
            placeholder="Type your Password..." 
            TextMode="Password" 
            MaxLength="20"/>
    </td>
    
    <td><br/>
           <asp:RequiredFieldValidator ID="RequiredFieldValidator2" 
           runat="server" 
           ErrorMessage="RequiredFieldValidator" 
           ControlToValidate="TextBox1">
            You need to type your Password
           </asp:RequiredFieldValidator>
           
           <br />
           
           <asp:CustomValidator runat="server" 
            ID="CustomValidator1" 
            ControlToValidate="TextBox1"
            Text="Password length should be more than 6 digits" 
            ClientValidationFunction="clientValidate" 
            Display="Dynamic">
           </asp:CustomValidator>
           
           <br />
           
            <asp:RegularExpressionValidator id="RegularExpressionValidator1" 
             ControlToValidate="TextBox1"
             ValidationExpression="[a-zA-Zs0-9]{6,20}$"
             AutoPostBack="true"
             Display="Static"
             ErrorMessage="Password must contain only Alpha-Numeric Characters"
             EnableClientScript="False" 
             runat="server"/>

    </td>
    
    </tr>
	
	<tr>
	<td><asp:Button ID="Button1" runat="server" Text="Login" class="btn btn-primary" type="submit" />
	</td>
	
	<td><asp:Button ID="Button2" runat="server" Text="Reset" class="btn btn-primary" type="reset"/><br/><br/>
	<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/forgotPassword.aspx">Did You Forget Your Password?</asp:HyperLink>
	</td>
        
	<td>
	</td>
	
	</tr>
        
	</table>
	
	</form> 

	</div>
  
  
    <script src="js/bootstrap.js"></script>
    <script type="text/javascript">
        function clientValidate(sender, args) 
        {
            if (args.Value.length < 6) 
            {
                args.IsValid = false;
            }
        }
    </script>
    
</body>
</html>
